#pragma once
#include "Scene.h"
#include "SceneManager.h"
#include "Randomizer.h"
#include "ScreenText.h"
#include "Object2D.h"
#include "Image.h"
#include "ScoreSystem.h"
//using namespace std;
using namespace Pulpy;

bool bGetDelay(const int delay, int & prevTime, bool bResetPrevTime = true);

class CEnemy
{
public:
	CEnemy();
	~CEnemy();

	bool getRender(void) { return bRender; };
	void setRender(bool inBool) { bRender = inBool; };
private:
	bool bRender;
};

class SuckTheMinions : public Scene
{
public:
	SuckTheMinions(void);
	~SuckTheMinions(void);

	void ScoreFunc(bool Player1Flag, int EnemyChoice);
	
	void draw();
	void update();
	void reset();
	void freeResource();
	void loadResource();
	void handleKeyboard(int key, int x, int y);
	void handleKeyboardUp(int key, int x, int y);
	void handleKeyboardSpecial(int key, int x, int y);
	void getMid(int &x, int &y);
	void handleMouseClick(int button, int state, int x, int y);
	void handleMouseMove(int x, int y);

private:
	int GameTimeLeft;
	bool GameRunning, GameGetReady;
	bool Player1WinFlag;

	Object2D Background;
	Object2D Main_Title;
	Object2D Continue;
	Object2D TimeLeft_Tenth;
	Object2D TimeLeft_One;
	Object2D TimeLeftChar;
	Sprite * Numbers[1];
	TextureImage Image_Background[2];
	TextureImage Image_Main_Title[2];
	TextureImage Image_Char_S;
	int MainTitlePrevTime, InstructPrevTime, GameRunPrevTime, CloudDraw;
	bool DrawInstruct[5];

	bool DrawGo;
	int GetReadyPrevTime;
	Object2D Ready, Go;
	TextureImage Image_Ready, Image_Go;

	Object2D Word_Player;
	Object2D Word_Wins;
	TextureImage Image_EndGame[4];
	int EndGamePrevTime;
	bool DrawContinue;

	CEnemy * theEnemy;
	int EnemyPrevTime, EnemyRenderTime, EnemyNotRenderTime;
	int P1_Score, P2_Score;
	bool bRenderEnemy;
	enum { RED = 0, GREEN, BLUE };

	Object2D Enemy_Cloud;
	TextureImage Image_Cloud[2];
	bool isBeingSucked;
	int CloudPrevTime;
	enum { CLOUD_SMILE = 0, CLOUD_ANGRY };

	Object2D Player[2];
	TextureImage Image_Vacuum[2];
	bool isSucking[2];
	int VacuumPrevTime;
	int VacuumHeight, VacuumWidth;
	enum { PLAYER_ONE = 0, PLAYER_TWO };

	Object2D SceneImages[3];
	TextureImage Image_Instruct[3];
	Vector2D<float> ImageSize[3];

	int AIReactionPrevTime, AIScoringPrevTime;
};
